// 导入Vue核心组件
import Vue from 'vue'

// 导入Vue 异步请求
import VueResource from 'vue-resource'
Vue.use(VueResource)
// Vue.http.options.root = 'http://localhost:8080';
Vue.http.options.root = 'http://048ecdba.nat.nsloop.com'
Vue.http.options.emulateJSON = true

// 导入router路由
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 导入状态管理库 Vuex
import Vuex, { Store } from 'vuex'
Vue.use(Vuex)

// 导入核心组件
import app from "./app.vue"

// 导入MintUi 框架
import MintUi from 'mint-ui'
import 'mint-ui/lib/style.min.css'
Vue.use(MintUi)

// 导入Mui 框架
import './lib/MUI/dist/css/mui.min.css'
import './lib/MUI/dist/css/icons-extra.css'

// 导入bootstrap 框架
import '../node_modules/bootstrap/dist/css/bootstrap.css'

// 创建状态管理实例
import store from './js/store.js'

// 创建路由实例
import router from './js/router.js'

// 请求错误代码
import error from './js/error.js'

// 引入图片资源
import IMG from './js/importImg.js'


Vue.http.interceptors.push(function (request) {

    // modify method
    //request.method = 'POST';
    request.headers.set('cubelibrarytoken', sessionStorage.getItem("cubelibrarytoken"));
    // modify headers

    return function (response) {
        error(response.status, this);
    }
});


const vm = new Vue({
    el: "#app",
    render: c => c(app),
    store,
    router,  
})